import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const mutations = {
    setViewer(state, viewer) {
        state.viewer = viewer;
    },
    setDrawControl(state, drawcontrol) {
        state.drawcontrol = drawcontrol
    },
    setViewerWidth(state, viewerWidth) {
        state.viewerWidth = viewerWidth
    }

};

const getters = {
    getViwer(state){
        return state.viewer
    },
    getDrawControl(state){
        return Object.create(state.drawcontrol) 
    }
};

const state = {
    viewer:undefined,
    drawcontrol:undefined,
    viewerWidth:100,
};

const store = new Vuex.Store({
    mutations:mutations,
    state:state,
    getters:getters,
});

export default store;